Caption = "The code is in each button's click event. Watch the debug window to see whats happening. "
ForeColor = &H00800000&
Height = 435
Left = 120
TabIndex = 8
Top = 3840
Width = 6075
End
Begin Label Label4
Caption = "Passes and returns integers."
Height = 435
Left = 2820
TabIndex = 7
Top = 3180
Width = 4095
End
Begin Label Label3
Caption = "Passes a user defined type array to the dll to be loaded with all files in the current directory. This example passes fixed-length strings, which don't have a null-terminator at the end."
Height = 855
Left = 2820
TabIndex = 6
Top = 2100
Width = 4095
End
Begin Label Label2
Caption = "Passes a regular VB string 'Dim S as string' to the dll to be trimmed. The function passes back a regular VB string."
Height = 615
Left = 2880
TabIndex = 5
Top = 1140
Width = 4095
End
Begin Label Label1
Caption = "Uses a Delphi form to get the password. This example passes a null-terminated string."
Height = 615
Left = 2880
TabIndex = 4
Top = 120
Width = 4155
End
Option Explicit
Declare Function GetPassword Lib "vbdll.dll" (ByVal Password As String) As Integer
Declare Function RTrimStr Lib "vbdll.dll" (s As String) As String
Declare Function MinInt Lib "vbdll.dll" (i As Integer, j As Integer) As Integer
Declare Function MaxInt Lib "vbdll.dll" (ByVal i As Integer, ByVal j As Integer) As Integer
Declare Function GetDirEntries Lib "vbdll.dll" (s$, DirInfoArray() As Any) As Integer
Sub cmdTestPassword_Click ()
Const MB_OK = 0
Const MB_ICONEXCLAMATION = 48
Dim DgDef, Msg, Response, Title, Rtn As Integer
Dim ExpectedPassword As String
ExpectedPassword = "MyPassword"
'Rtn = GetPassword("MyPassword") 'This also works
Rtn = GetPassword(ExpectedPassword)
Debug.Print
Debug.Print "Password Expected string passed to function: "; ExpectedPassword